package thread4;

public class Test2 {
    public static void main(String[] args) {
        Object locker1 = new Object();
        Object locker2 = new Object();

        Thread thread1 = new Thread() {
            @Override
            public void run() {
                synchronized (locker1) {
                    synchronized (locker2) {

                    }
                }
            }
        };
        thread1.start();

        Thread thread2 = new Thread() {
            @Override
            public void run() {
                synchronized (locker1) {
                    synchronized (locker2) {

                    }
                }
            }
        };
        thread2.start();
    }
}
